package delete

import (
	"errors"
	"fmt"
	"github.com/urfave/cli/v2"
	"gluenet/internal/client/util"
)

func instance(ctx *cli.Context) error {
	if ctx.NArg() != 1 {
		return errors.New("only 1 argument needed")
	}
	guid := ctx.Args().Get(0)

	_, err := util.HttpRequest("DELETE", cliUrl+"/apis/instance/del?id="+guid, nil)
	if err != nil {
		return err
	}

	fmt.Println("Succeed")

	// TODO not tested
	return nil
}
